package com.mrjy.video.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrjy.common.entity.VideoGoodsInfo;
import com.mrjy.common.entity.UserInfo;
import com.mrjy.common.util.GlobalConstant;
import com.mrjy.video.bo.IVideoGoodsInfoBo;

@Controller
@RequestMapping("/video/videoGoods")
public class VideoGoodsInfoController {
	@Resource
    private IVideoGoodsInfoBo videoGoodsBo;

	/**
     *视频评论点赞
     *
     * @param courseType
	 * @return
	 */
    @RequestMapping("/addVideoGoods")
    @ResponseBody
    public Object addVideoGoods(VideoGoodsInfo courseVideoGoods, HttpSession session) {
        UserInfo userInfo = (UserInfo) session.getAttribute(GlobalConstant.USER_INFO);
        courseVideoGoods.setVideoId(courseVideoGoods.getId());
        return videoGoodsBo.txAddVideoGoods(courseVideoGoods, userInfo);
    }

	/**
     * 根据ID查询表
     *
     * @return
	 */
	@RequestMapping("/queryById")
	@ResponseBody
	public Object queryById(int id) {
        VideoGoodsInfo courseType = videoGoodsBo.queryById(id);
        return courseType;
    }

	/**
	 * 修改
     *
     * @param courseType
	 * @return
	 */
	@RequestMapping("/updateById")
	@ResponseBody
	public Object updateById(VideoGoodsInfo courseVideoGoods) {
        videoGoodsBo.txUpdateById(courseVideoGoods);
        return "ok";
	}

	/**
	 * 删除
     *
     * @param ids
	 * @return
	 */
	@RequestMapping("/deleteByIds")
	@ResponseBody
	public Object deleteByIds(int[] ids) {
        return videoGoodsBo.txDeleteByIds(ids);
    }

	/**
	 * 禁用、起用
     *
     * @param ids
	 * @return
	 */
	@RequestMapping("/updateDisableFlag")
	@ResponseBody
	public Object updateDisableFlag(VideoGoodsInfo courseVideoGoods) {
        return videoGoodsBo.updateDisableFlag(courseVideoGoods);
    }

}
